<?php

namespace app\common\model;

/**
 * [Vercode  验证码表]
 * @author [C。]
 * @return html
 */
class Vercode extends Base
{
    protected $name = 'vercode';
    /**
     * 根据搜索条件获取列表信息
     */
    public function getlist($map,$from = 0, $size = 5)
    {
        $order = ['v.id' => 'desc'];
        $join = [
            ['app_member am','am.tel = v.tel'],
        ];
        $result =  $this->field('v.id,v.tel,v.code,v.status,v.status,v.addtime,v.type,am.username')
            ->alias('v')
            ->join($join)
            ->where($map)
            ->order($order)
            ->limit($from, $size)
            ->select();

        return $result;
    }
    /**
     * 根据搜索条件获取总条数
     */
    public function getCount($map)
    {
        $join = [
            ['app_member am','am.tel = v.tel'],
        ];
        $result =  $this->alias('v')
            ->join($join)
            ->where($map)
            ->count();

        return $result;
    }
    /**
     * 根据搜索条件获取列表信息
     */
    public function getlists($map,$from = 0, $size = 5)
    {
        $order = ['id' => 'desc'];
        $result =  $this->field('id,tel,code,status,status,addtime,type')
            ->alias('v')
            ->where($map)
            ->order($order)
            ->limit($from, $size)
            ->select();

        return $result;
    }
    /**
     * 根据搜索条件获取总条数
     */
    public function getCounts($map)
    {
        $result =  $this
            ->where($map)
            ->count();

        return $result;
    }
}